package com.j283_5.wisdom_park.controller.asset_management;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.j283_5.wisdom_park.common.result.ResultData;
import com.j283_5.wisdom_park.pojo.Tenement;
import com.j283_5.wisdom_park.pojo.Visitors;
import com.j283_5.wisdom_park.service.RoomService;
import com.j283_5.wisdom_park.service.TenementService;
import com.j283_5.wisdom_park.vo.asset_management.Ten_RoomVo;
import com.j283_5.wisdom_park.vo.contract_management.InsertRoomVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  楼宇管理
 * </p>
 *
 * @author 冯弋舟
 * @since 2022-04-28
 */
@RestController
@RequestMapping("/tenement")
@Api(value = "楼宇管理",tags = "楼宇管理",produces="冯弋舟")
public class TenementController {
    @Resource
    private TenementService service;
    @Resource
    private RoomService roomService;
    /**
     * 多条件查询楼宇信息
     * @return
     */
    @RequestMapping(value = "/findTenement" , method = RequestMethod.GET)
    @ApiOperation(value = "多条件查询楼宇信息",notes = "多条件查询楼宇信息（分页）",produces="冯弋舟", response = ResultData.class)
    public ResultData findTenement( Page<Tenement> page, String ten_name){
      return service.findTenement(ten_name,page);
    }

    /**
     * 空间管理_楼宇
     * @return
     */
    @RequestMapping(value = "/findSpace_Ten" , method = RequestMethod.POST)
    @ApiOperation(value = "空间管理_楼宇",notes = "空间管理_楼宇",produces="冯弋舟", response = ResultData.class)
    public ResultData findSpace_Ten(Integer tenId){
       return service.findTenementById(tenId);
    }

    /**
     * 空间管理_房间
     * @return
     */
    @RequestMapping(value = "/findSpace_Room" , method = RequestMethod.POST)
    @ApiOperation(value = "空间管理_房间",notes = "空间管理_房间",produces="冯弋舟", response = ResultData.class)
    public ResultData findSpace_Room(Integer tenId){
        return service.findRoomById(tenId);
    }

    /**
     * 进入空间管理_房间新增界面
     * @return
     */
    @RequestMapping(value = "/insertRoomInterface" , method = RequestMethod.POST)
    @ApiOperation(value = "进入空间管理_房间新增界面",notes = "进入空间管理_房间新增界面",produces="冯弋舟", response = ResultData.class)
    public ResultData insertRoomInterface(Integer tenId){
        return roomService.insertRoomInterface(tenId);
    }

    /**
     * 空间管理_房间新增
     * @return
     */
    @RequestMapping(value = "/insertRoom" , method = RequestMethod.POST)
    @ApiOperation(value = "空间管理_房间新增",notes = "空间管理_房间新增",produces="冯弋舟", response = ResultData.class)
    public ResultData insertRoom(InsertRoomVo insertRoomVo){
        return roomService.insertRoom(insertRoomVo);
    }

    /**
     * 空间管理_楼宇新增
     * @return
     */
    @RequestMapping(value = "/insertSpace_Ten" , method = RequestMethod.POST)
    @ApiOperation(value = "空间管理_楼宇新增",notes = "空间管理_楼宇新增",produces="冯弋舟", response = ResultData.class)
    public ResultData insertSpace_Ten(Tenement tenement){
      return service.insertTenement(tenement);
    }

    /**
     * 空间管理_楼宇删除
     * @return
     */
    @RequestMapping(value = "/deleteSpace_Ten" , method = RequestMethod.POST)
    @ApiOperation(value = "空间管理_楼宇删除",notes = "空间管理_楼宇删除",produces="冯弋舟", response = ResultData.class)
    public ResultData deleteSpace_Ten(@RequestBody List<Integer> tenId){

        return service.deleteTenement(tenId);
    }

}

